package com.btl.service.ai.support.input.common.parse.strategy.parser;

import com.btl.service.ai.support.input.common.parse.strategy.ParseStrategy;
import com.btl.service.ai.support.input.common.parse.strategy.FileTypeEnum;
import dev.langchain4j.data.document.Document;
import dev.langchain4j.data.document.parser.TextDocumentParser;
import org.springframework.stereotype.Service;

import java.io.InputStream;

@Service
public class TextSParseStrategy implements ParseStrategy {

    @Override
    public FileTypeEnum fileType() {
        return FileTypeEnum.TEXT;
    }

    @Override
    public Document parse(InputStream inputStream) {
        TextDocumentParser textDocumentParser = new TextDocumentParser();
        return textDocumentParser.parse(inputStream);
    }

}
